package com.example.demo.common;

import org.apache.tomcat.util.codec.binary.Base64;
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;

public class BASE64Util {

    public static String encode(byte[] bytes) {
        return new String(Base64.encodeBase64(bytes));
    }

    public static String decode(byte[] bytes) {
        return new String(Base64.decodeBase64(bytes));
    }
    public static void main(String[] args) {
        String string = "15000000011";

        //编码
        String encode = encode(string.getBytes());
        System.out.println(string + "编码后：" + encode);
        //解码
        String decode = decode(encode.getBytes());
        System.out.println(encode + "解码后" + decode);

    }
}
